package com.aaa.dao;

import com.aaa.entity.Student;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface StudentDao {
    /**
     * 查询所有
     * @param stuname
     * @param status
     * @return
     */
    public List<Student> listAll(@Param("stuname") String stuname,@Param("status") String status);

    /**
     * realm根据用户名查询用户是否存在
     * @param stuname
     * @return
     */
    @Select("select * from student where stuname=#{stuname}")
    public Student getStuname(String stuname);
    /**
     * 新增
     * @param student
     * @return
     */
    @Insert("insert into student(stuno,password,status,stuname,address) values(#{stuno},#{password},#{status},#{stuname},#{address}) ")
    public Integer insert(Student student);

    /**
     * 修改
     * @param student
     * @return
     */
    @Update("update student set stuno=#{stuno},password=#{password},status=#{status},stuname=#{stuname},address=#{address} where id=#{id}")
    public Integer update(Student student);
    /**
     * 批量删除
     * @param id
     * @return
     */
    @Delete("delete from student where id=#{id}")
    public Integer batchDelete(Integer id);
    /**
     * 查询详情信息
     * @param id
     * @return
     */
    @Select("select distinct r.remark from student s, s_remark r where r.s_id=#{id}")
   public List<Student> selectRemark(Integer id);

}
